package p2000;

import java.util.Scanner;

public class Main2019数列有序 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int n = scanner.nextInt();
            int m = scanner.nextInt();

            if (n == 0 && m == 0) {
                break;
            }

            int a = scanner.nextInt();
            String result = "";
            boolean flag = true;
            if (m <= a) {
                result += m + " ";
                result += a + " ";
                flag = false;
            } else {
                result += a + " ";
            }

            while (n-- > 1) {
                a = scanner.nextInt();
                if (flag) {
                    if (m <= a) {
                        result += m + " ";
                        result += a + " ";
                        flag = false;
                    } else {
                        result += a + " ";
                    }
                } else {
                    result += a + " ";
                }
            }

            System.out.println(result.substring(0, result.length() - 1));
        }
    }

}
